<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <div :style=" isActive ? 'background-color:red' : 'background-color:green' ">
            动态绑定style-三目写法
        </div>
        <div :style="styleObj">
            动态绑定style-对象写法
        </div>
        <div :style="styleArr">
            动态绑定style-数组写法
        </div>
    </div>

    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                isActive: false,
                styleObj: {
                    backgroundColor: 'red'      //background-color需转换成小驼峰命名格式
                },
                styleArr: [{backgroundColor: 'green'}]      //background-color需转换成小驼峰命名格式
            }
        })
    </script>
</body>
</html>